<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>hold session</title>
<style type="text/css">
    #content > div {float: left;margin-left: 5px;}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>


<script type="text/javascript">
  var removeIframe = function(obj) {
	var flag = confirm('确认删除?');
	if (flag) {
		$(obj).parent().parent().remove();
	}
  }
  
  jQuery(function() {
	 $("#add_url_btn").click(function() {
		 var url = $("#url").val();
		 $("#content").append("<div><div><span class='url'>"+ url +"</span><a href='javascript:;' onclick='removeIframe(this)'>X</a></div><iframe src='"+ url +"' style='height:300px;width:400px;'></iframe></div>");
	 });
	 
	 //定时
	 window.setInterval(function() {
		 var rnd = Math.random();
		 var links = $("#content iframe").each(function(i, item) {
			 var url = $(this).prev().find(".url").text();
			 $(this).attr("src", url + ((url.indexOf("?")>-1)?"&":"?") + rnd );
		 });
	 }, 300000);//5min
  });
  
</script>

</head>
<body onbeforeunload="return '您确定要离开“当前页面”吗？'">
    Url : <input type="text" id="url" onkeydown="if (event.keyCode==13)$('#add_url_btn').click()"/>
    <input type="button" value="Add" id="add_url_btn" />
    
    <div id="content">
        
    </div>
</body>
</html>